package com.myway.components.payment.wxpay.util;

import java.util.HashMap;

/**
 * 类名称：WxPayConstant <br/>
 * 类描述：微信支付 <br/>
 * 创建时间：2016年4月5日 下午1:56:32 <br/>
 * @author 张涛
 * @version V1.0
 */
public enum WxPay {

	//应用标示
	APP_ID("appid"),
	
	//附加数据
	ATTACH("attach"),
	
	//附加主体
	BODY("body"),
	
	//商编
	MCH_ID("mch_id"),
	
	//随机串
	NONCE_STR("nonce_str"),
	
	//
	NOTIFY_URL("notify_url"),
	
	OPENID("openid"),
	
	OUT_TRADE_NO("out_trade_no"),
	
	SPBILL_CREATE_IP("spbill_create_ip"),
	
	TIME_EXPIRE("time_expire"),
	TOTAL_FEE("total_fee"),
	
	TRADE_TYPE("trade_type"),
	
	TIME_START("time_start"),
	
	
	
	/**返回信息**/
	RETURN_CODE("return_code"),
	
	RETURN_MSG("return_msg"),
	
	RESULT_CODE("result_code"),
	
	ERR_CODE_DES("err_code_des"),
	
	PREPAY_ID("prepay_id"),
	
	/**状态**/
	SUCCESS("SUCCESS"),
	
	
	
	
	
	/**退款信息**/
	
	OP_USER_ID("op_user_id"),
	
	OUT_REFUND_NO("out_refund_no"),
	
	REFUND_FEE("refund_fee"),
	
	XXX("openid"),
	
	TRANSACTION_ID("transaction_id"),
	TIME_END("time_end"),
	TRADE_STATE_DESC("trade_state_desc"),
	TRADE_STATE("trade_state");
	
	
	private final String alias;
	private static HashMap<String, WxPay> map;

	static {
		map = new HashMap<String, WxPay>();
		for (WxPay type : WxPay.values()) {
			map.put(type.alias, type);
		}
	}

	WxPay(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;
	}

	public static WxPay valueOfAlias(String alias) {
		WxPay type = map.get(alias);
		if (type == null) {
			throw new IllegalArgumentException("Unknown pay type alias [" + alias + "]");
		}
		return type;
	}
	
}
